package com.linkhub.oms.data.sync.api.wms.client;

import cn.hutool.core.util.RuntimeUtil;
import com.dtflys.forest.annotation.JSONBody;
import com.dtflys.forest.annotation.Post;
import com.dtflys.forest.annotation.Var;
import com.dtflys.forest.http.ForestResponse;
import com.linkhub.oms.data.sync.api.wms.domain.request.*;
import com.linkhub.oms.data.sync.api.wms.domain.response.*;

/**
 * @Description: WmsClient
 * @Author: echo
 * @Date: 2024/5/6 15:49
 * @Version: 1.0
 */
public interface WmsClient {

    /**
     * 新建商品接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return SyncProductResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<SyncProductResponse> syncProduct( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                     @Var("sign") String sign,
                                                     @JSONBody SyncProductRequest request );

    /**
     * 调用入库单创建接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return EntryOrderCreateResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<EntryOrderCreateResponse> createEntryOrder( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                               @Var("sign") String sign,
                                                               @JSONBody EntryOrderCreateRequest request );

    /**
     * 入库单批量创建接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return EntryOrderCreateResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<EntryOrderBatchCreateResponse> batchCreateEntryOrder( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                                         @Var("sign") String sign,
                                                                         @JSONBody EntryOrderBatchCreateRequest request );

    /**
     * 出库单批量创建接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return EntryOrderCreateResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<StockOutBatchCreateResponse> batchCreateStockOutList( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                                         @Var("sign") String sign,
                                                                         @JSONBody StockOutBatchCreateRequest request );

    /**
     * 批量取消WMS单据接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return EntryOrderCreateResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<CancelOrderResponse> batchCancelOrderOrder( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                               @Var("sign") String sign,
                                                               @JSONBody BatchCancelOrderRequest request );

    /**
     * 创建加工单接口
     *
     * @param urlRequest urlRequest
     * @param sign       sign
     * @param request    request
     * @return StoreProcessCreateResponse
     */
    @Post(value = "#{wms.openapiUrl}" +
            "?method={urlRequest.method}" +
            "&timestamp={urlRequest.timestamp}" +
            "&format={urlRequest.format}" +
            "&app_key={urlRequest.app_key}" +
            "&v={urlRequest.v}" +
            "&sign={sign}" +
            "&sign_method={urlRequest.sign_method}" +
            "&customerId=#{wms.customerId}",
            dataType = "json")
    ForestResponse<StoreProcessCreateResponse> createStoreProcess( @Var("urlRequest") WmsBaseURLRequest urlRequest,
                                                                   @Var("sign") String sign,
                                                                   @JSONBody StoreProcessCreateRequest request );
}
